import request from '@/utils/request'

/**
 * 签约信息列表
 * http://192.168.88.247:4999/web/#/80/3061
 * @param {*} data
 * @returns
 */
export function listAgreement (data) {
  return request({
    url: '/v1/agreement/list',
    // method: 'get',
    // params: query
    method: 'post',
    data
  })
}

/**
 * 解约
 * http://192.168.88.247:4999/web/#/80/3137
 * @param {*} data
 * @returns
 */
export function unsignAgreement (data, codeObj) {
  return request({
    url: `/v1/agreement/unsign?vcode=${codeObj.code}&vid=${codeObj.vid}`,
    method: 'post',
    data
  })
}

/**
 * 修改签约信息
 * http://192.168.88.247:4999/web/#/80/3062
 * @param {*} data
 * @returns
 */
export function updateAgreement (data, codeObj) {
  return request({
    url: `/v1/agreement/update?vcode=${codeObj.code}&vid=${codeObj.vid}`,
    method: 'post',
    data
  })
}

/**
 * 批量修改签约信息
 * http://192.168.88.247:4999/web/#/80/3063
 * @param {*} data
 * @returns
 */
export function batchUpdateAgreement (data, codeObj) {
  return request({
    url: `/v1/agreement/batch_update?vcode=${codeObj.code}&vid=${codeObj.vid}`,
    method: 'post',
    data
  })
}

/**
 * 查看批量修改的group info
 * http://192.168.88.247:4999/web/#/80/3066
 * @param {*} data
 * @returns
 */
export function getAgreementGroup (data) {
  return request({
    url: `/v1/agreement/pre_batch_update`,
    method: 'post',
    noMsg: true,
    data
  })
}

/**
 * 创建导出任务
 * http://showdoc.wisetimes.cn:4999/web/#/80/3067
 * @param {*} data
 * @returns
 */
export function createExportAgreementTask (data) {
  return request({
    url: '/v1/agreement/export_task',
    method: 'post',
    data
  })
}

/**
 * 查询导出任务结果
 * http://showdoc.wisetimes.cn:4999/web/#/80/3068
 * @param {*} params
 * @returns
 */
export function queryExportAgreementTask (params) {
  return request({
    url: '/v1/agreement/export_task',
    method: 'get',
    params
  })
}

/**
 * 获取签约提醒消息列表
 * http://192.168.88.247:4999/web/#/80?page_id=3385
 * @param {*} params
 * @returns
 */
export function getAgreementMessages (params) {
  return request({
    url: '/v1/agreement/messages',
    method: 'get',
    params
  })
}
